package com.syp.jrx.batch.entity;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

public class entityRowMapper implements RowMapper<ArrayList<entity>> {
    @Override
    public ArrayList<entity> mapRow(ResultSet resultSet, int i) throws SQLException {
        ArrayList<entity> list = new ArrayList<>();
        for (int j = 0; j < resultSet.getRow(); j++) {
            entity tity=new entity();
            tity.setTrans_id(resultSet.getInt("trans_id"));
            tity.setCust_id(resultSet.getInt("cust_id"));
            tity.setSurname(resultSet.getString("surname"));
            tity.setBill(resultSet.getBigDecimal("bill"));
            tity.setTrans_type(resultSet.getString("trans_type"));
            tity.setTxn_datetime(resultSet.getDate("txn_datetime"));
            list.add(tity);
        }
        return list;
    }
}
